package socket;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

public class Client {
    private Socket socket;
    public Client(){
        try {
            socket=new Socket("ccq",8888);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void start(){
        try {
            Scanner s=new Scanner(System.in);
            OutputStream output=socket.getOutputStream();
            while (true) {
                String s1=s.next();
                if (s1.equals("BBL")){
                    break;
                }
                output.write(s1.getBytes());
            }
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                socket.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static void main(String[] args) {
        Client client=new Client();
        client.start();
    }
}
